package org.ust.analyse;

import java.util.ArrayList;
import java.util.Iterator;

public class JITInstantiationStructure
{

	private String					classExpression;
	private ArrayList < String >	typeArguments;
	private String					type;
	private ArrayList < String >	arguments;

	@ SuppressWarnings ( "unchecked" )
	@ Override
	public String toString ( )
	{

		String output = "";
		if ( getClassExpression ( ) != null )
		{
			output += getClassExpression ( ).toString ( ) + " ";
		}

		output = "new " + getType ( ).toString ( ) + " ";

		ArrayList < String > tmpArray;
		if ( getTypeArguments ( ) != null && getTypeArguments ( ).size ( ) > 0 )
		{
			tmpArray = new ArrayList < String > ( getTypeArguments ( ).size ( ) );
			Iterator it = getTypeArguments ( ).iterator ( );
			while ( it.hasNext ( ) )
			{
				String type = it.next ( ).toString ( );
				output += type + " ";
				tmpArray.add ( type );
			}
		}

		if ( getArguments ( ) != null && getArguments ( ).size ( ) > 0 )
		{
			tmpArray = new ArrayList < String > ( getArguments ( ).size ( ) );
			Iterator it = getArguments ( ).iterator ( );
			while ( it.hasNext ( ) )
			{
				String type = it.next ( ).toString ( );
				output += type + " ";
				tmpArray.add ( type );
			}
		}
		return output;
	}

	public void setClassExpression ( String classExpression )
	{
		this.classExpression = classExpression;
	}

	public String getClassExpression ( )
	{
		return classExpression;
	}

	public void setTypeArguments ( ArrayList < String > typeArguments )
	{
		this.typeArguments = typeArguments;
	}

	public ArrayList < String > getTypeArguments ( )
	{
		return typeArguments;
	}

	public void setType ( String type )
	{
		this.type = type;
	}

	public String getType ( )
	{
		return type;
	}

	public void setArguments ( ArrayList < String > arguments )
	{
		this.arguments = arguments;
	}

	public ArrayList < String > getArguments ( )
	{
		return arguments;
	}
}
